import React from 'react';
import './index.less';
import { MemoryRouter as Router, Route } from 'react-router-dom';
// import { BrowserRouter as Router, Route } from 'react-router-dom';
// import { HashRouter as Router, Route } from 'react-router-dom';
import Home from './pages/home';
import Inner from './pages/inner';
import store from './store';
import { Provider } from 'mobx-react';
import Audio from 'components/audio';

// import 'vconsole/dist/vconsole.min.js';

const props = {
  basename: process.env.NODE_ENV !== 'production' ? '/' : '/hd/palace/',
};

const myStore = new store();

setInterval(() => {
  myStore.timer();
}, 1000);


const Routers = () => (
  <Router {...props}>
    <div>
      <Route exact path="/" component={Home} />
      <Route path="/inner/:palaceId" component={Inner} />
      <Audio playing={myStore.musicPlay} src={myStore.musicSrc}/>
    </div>
  </Router>
);

Tida.ready({
  // interactId:"", // 互动实列ID type string 若无抽奖模块，此参数无须传入。给错误的实例ID会走错误流程
  // module: [] // 应用所需要的模块。非必选，默认加载所有模块。支持的模块见注释。
  // sellerNick:"" // 商家名称
  // shopId:123 // 店铺ID 从url中取 可选
}, function(){
  // TODO
  Tida.hideTitle();
});


ReactDom.render(
  <Provider store={myStore}>
    <Routers />
  </Provider>,
  document.getElementById('root')
);
